// Header Protection
#ifndef _GAME_H_
#define _GAME_H_

// Include Files
#include "Event\Event.h"

// Forward Declarations

// managers
class CMeshManager;
class CShaderManager;
class CTextureManager;

// systems
class CWindow;
class COptions;
class CRenderer;
class CScene;

// Event Arguments
class CRenderStateEventArg;

/////////////////////////////////////////////////////////////////////////////////////
// Contains game data and runs the main game loop.
// Base Class - ISingleton<CGame> : Makes this class a singleton.
//            - IListener: Lets this class listen for events.
class CGame : public ISingleton<CGame>, public IListener
{
public:     // methods

	// Sets up the game.
	void Initialize();

	// Shuts down the game.
	void Shutdown();

	// Runs the main game loop.
	void Run();

public:     // events

	CEvent<CRenderStateEventArg> RenderStateAdd;
	CEvent<CRenderStateEventArg> RenderStateRemove;

	// scene state? then what to do with the 'object'... is there one any more? does it just manage all the states? does that mean we need an object manager as well as a scene manager?
	// does this mean my main thread is turning into the loading thread? it looks that way... and I don't have a problem with it, maybe game contains a list of objects
	//CEvent<CSceneStateEventArg> AddSceneState;
	//CEvent<CSceneStateEventArg> RemoveSceneState;

	//CEvent<CPhysicsStateEventArg> AddPhysicsState;    // physics state? probably...
	//CEvent<CPhysicsStateEventArg> RemovePhysicsState;
	//CEvent<CInputStateEventArg> AddInputState;        // input state? maybe...
	//CEvent<CInputStateEventArg> RemoveInputState;

private:    // friends
	friend class ISingleton<CGame>;

private:    // event handlers
	void OnWindowClose( CEventArg &_rArg );

private:    // methods
	CGame();
	~CGame();

private:    // dummy definitions
	CGame( CGame const & );
	CGame & operator =( CGame const & );

private:     // data

	// assets
	CSingleton<CMeshManager>    m_pMeshManager;
	CSingleton<CShaderManager>  m_pShaderManager;
	CSingleton<CTextureManager> m_pTextureManager;

	// systems
	CSingleton<CWindow>   m_pWindow;
	CSingleton<COptions>  m_pOptions;
	CSingleton<CRenderer> m_pRenderer;
	CSingleton<CScene>    m_pScene;

	// main loop
	bool_t m_bRunning;
};

// Header Protection
#endif // _GAME_H_
